<template>
	<view class="page">
		<input type="number" v-model="price" class="input" placeholder="请输入消费金额" />
		<view class="toEdit" @click="toEdit">生成二维码</view>
		<view class="modal" v-if="modalShow" @click="modalShow = false">
			<image :src="'data:image/'+src" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				price: "",
				src: "",
				modalShow: false,
			}
		},
		methods: {
			toEdit() {
				this.$getS('user/showqrcord', {
					money: this.price
				}, (res) => {
					this.src = res
					this.modalShow = true
				})
			},
			back() {
				uni.navigateBack();
			},
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}

	.page {
		border-top: 20rpx solid #F6F6F6;
		padding: 0 60rpx;
	}

	.icon {
		width: 228rpx;
		height: 228rpx;
		display: block;
		margin: 0 auto;
		margin-top: 140rpx;
	}

	.text {
		margin-top: 20rpx;
		font-size: 34rpx;
		text-align: center;
	}

	.reason {
		color: #666666;
		font-size: 26rpx;
		margin-top: 200rpx;
	}

	.input {
		line-height: 98rpx;
		border-radius: 8rpx;
		margin-top: 120rpx;
		height: 98rpx;
		border: 1px solid #E5E5E5;
		text-align: center;
		margin-bottom: 30rpx;
	}

	.toEdit {
		line-height: 98rpx;
		background: #22BF8A;
		border-radius: 8rpx;
		color: #fff;
		font-size: 34rpx;
		text-align: center;
		margin-top: 68rpx;
	}

	.back {
		margin-top: 30rpx;
		border-radius: 8rpx;
		border: 1px solid #EEEEEE;
		line-height: 98rpx;
		font-size: 34rpx;
		text-align: center;
		color: #999999;
	}

	.modal{
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background: rgba(0,0,0,.7);
		z-index: 10;
	}
	.modal image{
		display: block;
		height: 400rpx;
		width: 400rpx;
		position: absolute;
		top: 50%;
		margin-top: -200rpx;
		left: 225rpx;
	}
</style>
